package de.shortys.myhome.api.view.event.listener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import de.shortys.myhome.api.controller.AbstractModule;

public class ModuleFocusListener extends MouseAdapter {

	private AbstractModule module;

	public ModuleFocusListener(AbstractModule module) {
		super();
		this.module = module;
	}

	@Override
	public void mousePressed(MouseEvent e) {
		if (module.isFocused()) {
			module.defocus();
		} else {
			module.focus();
		}
	}

}
